package com.example.framework509.codeGen.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.example.framework509.common.annotation.Pattern;
import com.example.framework509.common.annotation.entityAnnotations.AllowNull;
import com.example.framework509.common.annotation.entityAnnotations.VerifyRepetitionField;
import org.apache.ibatis.type.DateTypeHandler;

import java.util.Date;

@TableName("gen_entity")
public class Entity {

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @Pattern("^[a-z]\\w+$")
    @VerifyRepetitionField
    private String name;

    @Pattern("^[a-z]\\w+$")
    private String module;

    @AllowNull
    private String description;

    private String creator;

    @TableField(typeHandler = DateTypeHandler.class)
    private String createTime;

    private String editor;

    @TableField(typeHandler = DateTypeHandler.class)
    private String editTime;

    @TableLogic
    private Date isDeleted;

    @Version
    private Integer version;

    @Override
    public String toString() {
        return "Entity{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", module='" + module + '\'' +
                ", description='" + description + '\'' +
                ", creator='" + creator + '\'' +
                ", createTime='" + createTime + '\'' +
                ", editor='" + editor + '\'' +
                ", editTime='" + editTime + '\'' +
                ", isDeleted=" + isDeleted +
                ", version=" + version +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getModule() {
        return module;
    }

    public void setModule(String module) {
        this.module = module;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public Date getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Date isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEditor() {
        return editor;
    }

    public void setEditor(String editor) {
        this.editor = editor;
    }

    public String getEditTime() {
        return editTime;
    }

    public void setEditTime(String editTime) {
        this.editTime = editTime;
    }
}
